package com.candy.util;

import com.candy.service.AccountService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Test01 {
    public static void main(String[] args) {
//加载容器
        ClassPathXmlApplicationContext ac=new ClassPathXmlApplicationContext("beans.xml");

        AccountService accountService= (AccountService) ac.getBean("accountServiceImpl");
        AccountService accountService2= (AccountService) ac.getBean("accountServiceImpl");
//使用==来比较两个对象的内存地址是否相同，
// 若相同，则表示两个对象为同一个，
// 若不相同，则指向两个内存地址，表示创建了两个不同的对象
        System.out.println(accountService);
        System.out.println(accountService2);
        System.out.println(accountService2==accountService);
        accountService.saveAccount();
        ac.close();



    }
}
